package cn.anquing.shardingsphere.demo;

import cn.anquing.shardingsphere.demo.entity.Demo;
import cn.anquing.shardingsphere.demo.service.DemoService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author wangqq65
 * @since 2021/9/3 13:53
 */
@RestController
@RequestMapping("/demo")
public class DemoController {

    @Resource
    private DemoService demoService;

    @GetMapping("/hello")
    public Object hello(String name){
        return "hello" + name;
    }

    @GetMapping("/list")
    public List<Demo> list(){
        return demoService.listAll();
    }
}
